package com.fortune.service.impl;

import com.fortune.dao.MSpecificationDao;
import com.fortune.dto.in.mSpecification.SpecificationAddDto;
import com.fortune.dto.in.mSpecification.SpecificationEditDto;
import com.fortune.dto.in.mSpecification.SpecificationListDto;
import com.fortune.service.MSpecificationService;
import com.fortune.vo.mSpecification.MSpecification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MSpecificationServiceImpl implements MSpecificationService {
    @Autowired
    private MSpecificationDao mSpecificationDao;

    /**
     * 查询规格码表
     * @param companyId
     * @param specificationListDto
     * @return
     */
    @Override
    public List<MSpecification> queryMSpecificationList(String companyId,SpecificationListDto specificationListDto) {
        return mSpecificationDao.queryMSpecificationList(companyId,specificationListDto);
    }

    /**
     * 查询规格码表个数
     * @param companyId
     * @param specificationListDto
     * @return
     */
    @Override
    public int queryMSpecificationListCount(String companyId, SpecificationListDto specificationListDto) {
        return mSpecificationDao.queryMSpecificationListCount(companyId,specificationListDto);
    }

    /**
     * 添加规格
     * @param companyId
     * @param specificationAddDto
     * @return
     */
    @Override
    public int addMSpecification(String companyId, SpecificationAddDto specificationAddDto) {
        return mSpecificationDao.addMSpecification(companyId,specificationAddDto);
    }

    /**
     * 编辑规格
     * @param companyId
     * @param specificationEditDto
     * @return
     */
    @Override
    public int editMSpecification(String companyId, SpecificationEditDto specificationEditDto) {
        return mSpecificationDao.editMSpecification(companyId,specificationEditDto);
    }

    /**
     * 删除规格
     * @param companyId
     * @param specificationId
     * @return
     */
    @Override
    public int deleteMSpecification(String companyId, String specificationId) {
        return mSpecificationDao.deleteMSpecification(companyId,specificationId);
    }

    /**
     * 添加时查重
     * @param companyId
     * @param specificationAddDto
     * @return
     */
    @Override
    public int queryAddMSpecificationExist(String companyId, SpecificationAddDto specificationAddDto) {
        return mSpecificationDao.queryAddMSpecificationExist(companyId,specificationAddDto);
    }

    /**
     * 编辑时查重
     * @param companyId
     * @param specificationEditDto
     * @return
     */
    @Override
    public int queryEditMSpecificationExist(String companyId, SpecificationEditDto specificationEditDto) {
        return mSpecificationDao.queryEditMSpecificationExist(companyId,specificationEditDto);
    }

    /**
     * 查询规格码表
     * @param companyId
     * @return
     */
    @Override
    public List<MSpecification> queryProduceMSpecificationList(String companyId) {
        return mSpecificationDao.queryProduceMSpecificationList(companyId);
    }
}
